<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>内置对象-数组</title>
</head>
<body>

</body>
<script>

    /*
    *  1. length
    *  2. 变异操作
    *
    *    添加/移除
    *       push/pop
    *       unshift/shift
    *
    * 3. 非变异操作
    *       filter/find
    *       sort
    *       map/reduce
    * */


    var arr = [1,3,3,4,2];

/*  arr.push(34);
    var num1= arr.pop();// 弹出*/
     arr.unshift(0);
    var num2= arr.shift();

    console.log(arr);
   // console.log("pop:"+num1);
    console.log("pop:"+num2);


   var arr2= arr.filter(function (item) {
        return item>2;//定义了过滤规则
    })

    var obj= arr.find(function (item) {
        return item>2;//定义了过滤规则
    })

    console.log("filtered:"+arr2);
    console.log("found:"+obj);

    /*
     *  冒泡排序
    * */


</script>
</html>